博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js 多选选择删除数据
阅读量:6991 次
发布时间:2019-06-27

本文共 3375 字,大约阅读时间需要 11 分钟。

按了顶上的删除(多项删除)

单列复选框删除 js语句

1 删除
1 

 

多列复选框删除js语句

先在table外套个form表单 并且指定id,其中给复选框指定name 和 value

<td><input type="checkbox" name="ids" value="${customer.id}"/></td>

1     
2
3 ............4
5
1     

参考

1 <%@ page language="java" contentType="text/html; charset=utf-8" 2     pageEncoding="utf-8"%> 3 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <%@taglib uri="http://www.WFReduceContent.com" prefix="reduce"%> 5  6  7  8 
9 Insert title here10 11 12
13
14
15
16
17
18
添加 多重删除
19
33
20
21
22
23
24
25
26
27
28
29
30
31
32
34
35
36
37
38
39
40
41
42
43
45
46 47
选择 姓名 性别 生日 电话 email 爱好 类型 描述 操作
${customer.name} ${customer.gender=="1"?"男":"女"} ${customer.birthday} ${customer.cellphone} ${customer.email} ${customer.hobby} ${customer.type}
编辑44 删除
48
84
85 86 87
View Code
1 package cn.itcast.Controller; 2  3 import java.io.IOException; 4 import javax.servlet.ServletException; 5 import javax.servlet.annotation.WebServlet; 6 import javax.servlet.http.HttpServlet; 7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletResponse; 9 10 import cn.itcast.service.CustomerService;11 import cn.itcast.service.impl.CustomerServiceImpl;12 13 public class DelCustomerServlet extends HttpServlet {14     private static final long serialVersionUID = 1L;15     private CustomerService service= new CustomerServiceImpl();16     public DelCustomerServlet() {17         super();18     }19 20     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {21         String method=request.getParameter("method");22         if("delMultiple".equals(method))            //多重删除23         {24             String ids[]=request.getParameterValues("ids");25             if(null!=ids&&ids.length>0)26                 for(String id:ids)27                     service.delCustomerById(id);28             request.getRequestDispatcher("ShowAllCustomer").forward(request, response);29             return;30         }31         //单条删除32         String customerId=request.getParameter("customerId");33         System.out.println( "servlet"+customerId);34         service.delCustomerById(customerId.trim());35         request.getRequestDispatcher("ShowAllCustomer").forward(request, response);36     }37     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {38         this.doGet(request, response);39     }40 41 }
View Code

 

转载于:https://www.cnblogs.com/friends-wf/p/3745159.html

你可能感兴趣的文章
Tomcat : IOException while loading persisted sessions: java.io.EOFException
查看>>
网络编程-粘包问题以及解决方案
查看>>
使用控制台启动Android设备模拟器
查看>>
subscription group permisson
查看>>
Flex实现页面跳转的功能可用性分析 .
查看>>
对HGE游戏引擎的一次封
查看>>
poj 2051 Argus
查看>>
div内快元素[div,p。。。]居中办法
查看>>
2017届高三(下)高考模拟(理科)数学试题(自己命题与写代码)
查看>>
swagger-editor
查看>>
Groovy与Java集成常见的坑(转)
查看>>
SpringMVC(转)
查看>>
__tostring用法,__call处理调用,__clone克隆对象
查看>>
PHP读取文件
查看>>
免费的区块链学习资料
查看>>
ILSVRC
查看>>
matlab超限像素平滑法_脉冲伏安法理论基础
查看>>
arduino 串口读取字符串_Arduino传感器教程 第24章NRF24L01 控制电舵机
查看>>
状态码202_HTTP状态码(HTTP Status Code)
查看>>
sharepoint 2010 网站集定期备份
查看>>